package com.ruoyi.Api;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.countrybus.domain.SysDispatchCustomer;
import com.ruoyi.project.countrybus.service.ISysDispatchCustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Api("乘客调度API")
@RestController
@RequestMapping("/api/schedulewithcustomer")
public class CustoerScheduleApi extends BaseController {
    @Autowired
    private ISysDispatchCustomerService sysDispatchCustomerService;

    /**
     * 查询乘客调度站点列表
     */
//    @PreAuthorize("@ss.hasPermi('countrybus:schedule:list')")
    @ApiOperation("查询乘客调度站点列表")
    @GetMapping("/list")
    public TableDataInfo list(SysDispatchCustomer sysDispatchCustomer)
    {
        startPage();
        List<SysDispatchCustomer> list = sysDispatchCustomerService.selectSysDispatchCustomerList(sysDispatchCustomer);
        return getDataTable(list);
    }


    /**
     * 获取乘客调度站点详细信息
     */
//    @PreAuthorize("@ss.hasPermi('countrybus:schedule:query')")
    @GetMapping(value = "/{scheduleId}")
    @ApiOperation("获取乘客调度站点详细信息")
    public AjaxResult getInfo(@PathVariable("scheduleId") Long scheduleId)
    {
        return AjaxResult.success(sysDispatchCustomerService.selectSysDispatchCustomerByScheduleId(scheduleId));
    }

    /**
     * 新增乘客调度站点
     */
//    @PreAuthorize("@ss.hasPermi('countrybus:schedule:add')")
//    @Log(title = "乘客调度站点", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增乘客调度站点")
    public AjaxResult add(@RequestBody SysDispatchCustomer sysDispatchCustomer)
    {
        return toAjax(sysDispatchCustomerService.insertSysDispatchCustomer(sysDispatchCustomer));
    }

    /**
     * 修改乘客调度站点
     */
//    @PreAuthorize("@ss.hasPermi('countrybus:schedule:edit')")
//    @Log(title = "乘客调度站点", businessType = BusinessType.UPDATE)
    @ApiOperation("修改乘客调度站点")
    @PutMapping
    public AjaxResult edit(@RequestBody SysDispatchCustomer sysDispatchCustomer)
    {
        return toAjax(sysDispatchCustomerService.updateSysDispatchCustomer(sysDispatchCustomer));
    }

    /**
     * 删除乘客调度站点
     */
//    @PreAuthorize("@ss.hasPermi('countrybus:schedule:remove')")
//    @Log(title = "乘客调度站点", businessType = BusinessType.DELETE)
    @ApiOperation("删除乘客调度站点")
    @DeleteMapping("/{scheduleIds}")
    public AjaxResult remove(@PathVariable Long[] scheduleIds)
    {
        return toAjax(sysDispatchCustomerService.deleteSysDispatchCustomerByScheduleIds(scheduleIds));
    }



}
